home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / insight / plugins / myabs.pro next >
Text File  |  1997-07-08  |  2KB  |  85 lines

  1. ; $Id: myabs.pro,v 1.3 1997/04/22 16:21:58 rob Exp $
  2. ;
  3. ; Copyright (c) 1997, Research Systems, Inc.  All rights reserved.
  4. ;   Unauthorized reproduction prohibited.
  5. ;+
  6. ; FILE:
  7. ;       myabs.pro
  8. ;
  9. ; PURPOSE:
  10. ;       This file contains an example Conditioning PlugIn that does absolute
  11. ;       value, without a dialog.
  12. ;
  13. ; CONTENTS:
  14. ;       CALLBACK ROUTINE
  15. ;           fun DoMyAbs                 - main entry point
  16. ;
  17. ;       REGISTRATION FUNCTION
  18. ;           fun MyAbs                   - registers the PlugIn
  19. ;
  20. ;-
  21.  
  22. FORWARD_FUNCTION ABS
  23.  
  24. ; *****************************************************************************
  25. ;       CALLBACK ROUTINE
  26. ; *****************************************************************************
  27.  
  28. ; -----------------------------------------------------------------------------
  29. ;
  30. ;   Purpose:  Main entry point for the PlugIn.
  31. ;
  32. function DoMyAbs, $
  33.     data, $             ; IN/OUT: the data to condition
  34.     GROUP=wGroup, $     ; IN: the widget group leader
  35.     _EXTRA=extra        ; IN: (unused keywords)
  36.  
  37.     ;  Get the type code.
  38.     ;
  39.     size = SIZE(data)
  40.     type = size[size[0] + 1]
  41.  
  42.     ;  Check for illegal data type (string).
  43.     ;
  44.     if (type eq 7) then begin
  45.         message = 'This type is not supported for absolute value.'
  46.         void = DIALOG_MESSAGE(message, DIALOG_PARENT=wGroup)
  47.         RETURN, 0B
  48.     endif
  49.  
  50.     ;  Do absolute value.
  51.     ;
  52.     if (type ne 1) then $
  53.         data = ABS(data)
  54.  
  55.     ;  Successful return.
  56.     ;
  57.     RETURN, 1B
  58.  
  59. end                 ; DoMyAbs
  60.  
  61. ; *****************************************************************************
  62. ;       REGISTRATION FUNCTION
  63. ; *****************************************************************************
  64.  
  65. ; -----------------------------------------------------------------------------
  66. ;
  67. ;   Purpose:  Register the Conditioning PlugIn.
  68. ;
  69. function MyAbs
  70.  
  71.     ;  Return the Conditioning PlugIn Registration Structure.
  72.     ;
  73.     RETURN, { $
  74.         type:       'Conditioning_PlugIn', $        ; PlugIn type
  75.         title:      'My Abs', $                     ; PlugIn title
  76.         purpose:    'Do absolute value.', $         ; PlugIn purpose
  77.         main_func:  'DoMyAbs', $                    ; main callback
  78.         version:    '5.0', $                        ; IDL version
  79.         revision:   '1.0' $                         ; PlugIn version
  80.         }
  81.  
  82. end                 ; MyAbs
  83.  
  84. ; -----------------------------------------------------------------------------
  85.